from workflow import NovelWorkflow
import logging

if __name__ == "__main__":
    # 配置日志格式
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    )
    
    # 初始化工作流
    workflow = NovelWorkflow()
    compiled_workflow = workflow.compile_workflow()
    
    # 执行工作流
    initial_state = {
        'current_outline': '',
        'chapters': {},
        'refinement_count': 0,
        'current_chapter': '第一章'
    }
    result = compiled_workflow.invoke(initial_state)
    
    # 输出最终结果
    logging.info("小说创作完成！最终审查建议：" + result['review'])